# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgbase=atkmm-2.36
pkgname=(atkmm-2.36 atkmm-2.36-docs)
pkgver=2.36.2
pkgrel=1
pkgdesc="C++ bindings for ATK"
url="https://www.gtkmm.org/"
arch=(loong64 x86_64)
license=(LGPL)
depends=(atk glibmm-2.68)
makedepends=(git meson mm-common glibmm-2.68-docs)
options=(debug !emptydirs)
_commit=4829d5f55c02b8a72e261c4ee097082693792e5d  # tags/2.36.2^0
source=("git+https://gitlab.gnome.org/GNOME/atkmm.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd atkmm
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd atkmm
}

build() {
  arch-meson atkmm build -D maintainer-mode=true
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_atkmm-2.36() {
  depends+=(libsigc-3.0.so libglibmm-2.68.so)
  provides=(libatkmm-2.36.so)

  meson install -C build --destdir "$pkgdir"

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_atkmm-2.36-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}
